package com.johann.aboutdate;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;

public class DateCircle {
    public static void main(String[] args)  {
        dateCircleDemo();
    }
    public static void dateCircleDemo()  {
        Calendar cal = Calendar.getInstance();
        Calendar calNowTime = Calendar.getInstance();
        calNowTime.add(Calendar.DAY_OF_MONTH,-1);
        try {
            cal.setTime( new SimpleDateFormat("yyyyMMdd").parse(null));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        while (cal.compareTo(calNowTime) < 0){
            System.out.println(cal.getTime().toString());
            cal.add(Calendar.DAY_OF_MONTH,1);
        }

    }
}
